{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "90cc0c45",
   "metadata": {},
   "source": [
    "# Kotlin DataFrame: Getting Started\n",
    "\n",
    "## What is this\n",
    "\n",
    "This is the short introduction for those Kotlin developers, who are familiar at least with syntax and basic concepts of Kotlin\n",
    "\n",
    "## What is this **not**\n",
    "\n",
    "This is not a guide which will help you to migrate from another language or technology to Kotlin DataFrame\n",
    "\n",
    "## What is Kotlin DataFrame\n",
    "\n",
    "_From now on I will refer to this library as \"KotlinDF\". Albeit the fact it is not official name, it's much shorter and comfortable to use._\n",
    "\n",
    "KotlinDF is a library to work with DataFrames. DataFrame is simple representation of any table-like data, that basically has columns and rows. Anyone who've seen products like MS Excel is already familiar with DF: one can add/remove/operate on columns/rows/cells, name etc.\n",
    "\n",
    "But of course programming gives us very powerful tools which are hard to use in spreadsheet editors — for example, aggregations.\n",
    "\n",
    "## Getting started\n",
    "\n",
    "### Task\n",
    "\n",
    "https://movielens.org/ is online service, providing recommendations based on user's taste. User may grade any movie from on a scale from 1 to 10 and some algorithm will give them recommendations based on their taste and taste of other users.\n",
    "\n",
    "Indeed, this service should contain comprehensive informtion about movies and, of course, lots of information produced by users, for example tags.\n",
    "\n",
    "You can obtain data [here](https://grouplens.org/datasets/movielens/). We will use some example data.\n",
    "\n",
    "Today we're going to dig following information:\n",
    "\n",
    "1. Find the most popular genre of movies since 1920\n",
    "1. Find the most tagged movie\n",
    "\n",
    "### Find the most popular genre of movies since 1920\n",
    "\n",
    "To query data we should at first read data. Read it to DF in our case. That's how we do it:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "4aef5dd1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "            <div id=\"kotlin_out_0\"/>\n",
       "            <script type=\"text/javascript\">\n",
       "                            if(!window.kotlinQueues) {\n",
       "                window.kotlinQueues = {};\n",
       "            }\n",
       "            if(!window.kotlinQueues[\"DataFrame\"]) {\n",
       "                var resQueue = [];\n",
       "                window.kotlinQueues[\"DataFrame\"] = resQueue;\n",
       "                window[\"call_DataFrame\"] = function(f) {\n",
       "                    resQueue.push(f);\n",
       "                }\n",
       "            }\n",
       "            (function (){\n",
       "                var modifiers = [(function(script) {\n",
       "    script.src = \"https://cdn.jsdelivr.net/gh/Kotlin/dataframe@d6467c1389bc031958acd5310fce39167b5cc581/src/main/resources/init.js\"\n",
       "    script.type = \"text/javascript\";\n",
       "})];\n",
       "                var e = document.getElementById(\"kotlin_out_0\");\n",
       "                modifiers.forEach(function (gen) {\n",
       "                    var script = document.createElement(\"script\");\n",
       "                    gen(script)\n",
       "                    script.addEventListener(\"load\", function() {\n",
       "                        window[\"call_DataFrame\"] = function(f) {f();};\n",
       "                        window.kotlinQueues[\"DataFrame\"].forEach(function(f) {f();});\n",
       "                        window.kotlinQueues[\"DataFrame\"] = [];\n",
       "                    }, false);\n",
       "                    script.addEventListener(\"error\", function() {\n",
       "                        window[\"call_DataFrame\"] = function(f) {};\n",
       "                        window.kotlinQueues[\"DataFrame\"] = [];\n",
       "                        var div = document.createElement(\"div\");\n",
       "                        div.style.color = 'darkred';\n",
       "                        div.textContent = 'Error loading resource DataFrame';\n",
       "                        document.getElementById(\"kotlin_out_0\").appendChild(div);\n",
       "                    }, false);\n",
       "                    \n",
       "                    e.appendChild(script);\n",
       "                });\n",
       "            })();\n",
       "            </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "                <style>\n",
       "                :root {\n",
       "    --background: #fff;\n",
       "    --background-odd: #f5f5f5;\n",
       "    --background-hover: #d9edfd;\n",
       "    --header-text-color: #474747;\n",
       "    --text-color: #848484;\n",
       "    --text-color-dark: #000;\n",
       "    --text-color-medium: #737373;\n",
       "    --text-color-pale: #b3b3b3;\n",
       "    --inner-border-color: #aaa;\n",
       "    --bold-border-color: #000;\n",
       "    --link-color: #296eaa;\n",
       "    --link-color-pale: #296eaa;\n",
       "    --link-hover: #1a466c;\n",
       "}\n",
       "\n",
       ":root[theme=\"dark\"], :root [data-jp-theme-light=\"false\"]{\n",
       "    --background: #303030;\n",
       "    --background-odd: #3c3c3c;\n",
       "    --background-hover: #464646;\n",
       "    --header-text-color: #dddddd;\n",
       "    --text-color: #b3b3b3;\n",
       "    --text-color-dark: #dddddd;\n",
       "    --text-color-medium: #b2b2b2;\n",
       "    --text-color-pale: #737373;\n",
       "    --inner-border-color: #707070;\n",
       "    --bold-border-color: #777777;\n",
       "    --link-color: #008dc0;\n",
       "    --link-color-pale: #97e1fb;\n",
       "    --link-hover: #00688e;\n",
       "}\n",
       "\n",
       "table.dataframe {\n",
       "    font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n",
       "    font-size: 12px;\n",
       "    background-color: var(--background);\n",
       "    color: var(--text-color-dark);\n",
       "    border: none;\n",
       "    border-collapse: collapse;\n",
       "}\n",
       "\n",
       "table.dataframe th, td {\n",
       "    padding: 6px;\n",
       "    border: 1px solid transparent;\n",
       "    text-align: left;\n",
       "}\n",
       "\n",
       "table.dataframe th {\n",
       "    background-color: var(--background);\n",
       "    color: var(--header-text-color);\n",
       "}\n",
       "\n",
       "table.dataframe td {\n",
       "    vertical-align: top;\n",
       "}\n",
       "\n",
       "table.dataframe th.bottomBorder {\n",
       "    border-bottom-color: var(--bold-border-color);\n",
       "}\n",
       "\n",
       "table.dataframe tbody > tr:nth-child(odd) {\n",
       "    background: var(--background-odd);\n",
       "}\n",
       "\n",
       "table.dataframe tbody > tr:nth-child(even) {\n",
       "    background: var(--background);\n",
       "}\n",
       "\n",
       "table.dataframe tbody > tr:hover {\n",
       "    background: var(--background-hover);\n",
       "}\n",
       "\n",
       "table.dataframe a {\n",
       "    cursor: pointer;\n",
       "    color: var(--link-color);\n",
       "    text-decoration: none;\n",
       "}\n",
       "\n",
       "table.dataframe tr:hover > td a {\n",
       "    color: var(--link-color-pale);\n",
       "}\n",
       "\n",
       "table.dataframe a:hover {\n",
       "    color: var(--link-hover);\n",
       "    text-decoration: underline;\n",
       "}\n",
       "\n",
       "table.dataframe img {\n",
       "    max-width: fit-content;\n",
       "}\n",
       "\n",
       "table.dataframe th.complex {\n",
       "    background-color: var(--background);\n",
       "    border: 1px solid var(--background);\n",
       "}\n",
       "\n",
       "table.dataframe .leftBorder {\n",
       "    border-left-color: var(--inner-border-color);\n",
       "}\n",
       "\n",
       "table.dataframe .rightBorder {\n",
       "    border-right-color: var(--inner-border-color);\n",
       "}\n",
       "\n",
       "table.dataframe .rightAlign {\n",
       "    text-align: right;\n",
       "}\n",
       "\n",
       "table.dataframe .expanderSvg {\n",
       "    width: 8px;\n",
       "    height: 8px;\n",
       "    margin-right: 3px;\n",
       "}\n",
       "\n",
       "table.dataframe .expander {\n",
       "    display: flex;\n",
       "    align-items: center;\n",
       "}\n",
       "\n",
       "/* formatting */\n",
       "\n",
       "table.dataframe .null {\n",
       "    color: var(--text-color-pale);\n",
       "}\n",
       "\n",
       "table.dataframe .structural {\n",
       "    color: var(--text-color-medium);\n",
       "    font-weight: bold;\n",
       "}\n",
       "\n",
       "table.dataframe .dataFrameCaption {\n",
       "    font-weight: bold;\n",
       "}\n",
       "\n",
       "table.dataframe .numbers {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "table.dataframe td:hover .formatted .structural, .null {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "table.dataframe tr:hover .formatted .structural, .null {\n",
       "    color: var(--text-color-dark);\n",
       "}\n",
       "\n",
       "\n",
       "                </style>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%useLatestDescriptors\n",
    "%use dataframe\n",
    "val rawMovies = DataFrame.read(\"../../idea-examples/movies/src/main/resources/movies.csv\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "51368a9d",
   "metadata": {},
   "source": [
    "Yes, that simple! KotlinDF determines format itself and load the data into value, called `movies`. But how should we query this data, we don't even know how doe sit look like. Let's explore it.\n",
    "\n",
    "The very basic will do the magic and will output the result:\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "ca3dda7f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-369098752\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 5, columnsCount = 3</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"9b30aff7943f44579e92c261f3adc193\",\"2a1ba1fc5caf492a80188e032995843e\",\"f44ceb4771504342bb856d76c112d5a6\",\"43d02fb064514ff3bd30d1e3a7398357\",\"6aa0d26a483148998c250b9c80ddf550\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Women in Black (1997)\",\"Bumblebee Movie (2007)\",\"<span class=\\\"formatted\\\" title=\\\"Magical School Boy and the Rock of Wise Men (2001)\\\">Magical School Boy and the Rock of Wi<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Master of the Jewlery: The Company of the Jewel (2001)\\\">Master of the Jewlery: The Company of<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Sun Conflicts: Part IV: A Novel Espair (1977)\\\">Sun Conflicts: Part IV: A Novel Espai<span class=\\\"structural\\\">...</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Fantasy|Suspenseful|Comedy\",\"Comedy|Jazz|Family|Animation\",\"Fantasy|Growing up|Magic\",\"Fantasy|Magic|Suspenseful\",\"Fantasy\"] }, \n",
       "], id: -369098752, rootId: -369098752, totalRows: 5 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-369098752) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rawMovies.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0d1b25d6",
   "metadata": {},
   "source": [
    "The structure is simple, right? Just three columns:\n",
    "\n",
    "1. movieId\n",
    "1. title\n",
    "1. genres\n",
    "\n",
    "_NB: Interesting observation: without any effort from our side KotlinDF already determined type of each column._\n",
    "\n",
    "And also we can already see the way to solve our first task. What do we eed to do?\n",
    "\n",
    "1. Extract the year to separate column\n",
    "1. If the year is not known — remove the movie from our DF — it's not relevant for us\n",
    "1. Remove the year from the title (because it's not an actual part of title)\n",
    "1. If genre is `(no genres listed)` — remove the movie from our DF — it's irrelevant for us\n",
    "1. Split genres by `|` simple\n",
    "1. Convert each row with multiple genres with multiple rows single genre each\n",
    "1. Group the data by year and genre\n",
    "1. Count the number of movies in each year-genre bucket\n",
    "\n",
    "#### Extract the year to separate column\n",
    "\n",
    "To add a column, based on another column we can use the `add` function. In our case it will look like this:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "c6e55d9e",
   "metadata": {},
   "outputs": [],
   "source": [
    "val moviesWithYear = rawMovies\n",
    "    .add(\"year\" /*①*/){ \n",
    "        \"\\\\d{4}\".toRegex() /*②*/.findAll(title/*③*/).lastOrNull()/*④*/?.value?.toInt/*⑤*/() ?: -1 /*⑥*/\n",
    "    }"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fbbb48d2",
   "metadata": {},
   "source": [
    "Let's look at all interesting places in this expression.\n",
    "\n",
    "- ① - We're adding a column named `year`\n",
    "- ② - To add column we'll use a regular expression `\\\\d{4}`, that just looks for any consecutive 4 digits\n",
    "- ③ - thank to jupyter magic we can call the column just by name! In other environments syntax may be a bit more cluttered, for example `\"title\"<String>()`. _This feature will be available outside of jupyter in future releases._\n",
    "- ④ - We are looking for the latest possible appearance of 4-digit sequences, or, if there are no such sequences returning `null`.\n",
    "- ⑤ - If it exists we're casting it to `Int`\n",
    "- ⑥ - Otherwilse we're returning `-1`. We have  strong belief that there were no movies filmed before 0 AD.\n",
    " \n",
    "Let's check if we've achieved our first goal, by calling `head` again. The output is\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "6bcdbe7e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-369098751\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 5, columnsCount = 4</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"9b30aff7943f44579e92c261f3adc193\",\"2a1ba1fc5caf492a80188e032995843e\",\"f44ceb4771504342bb856d76c112d5a6\",\"43d02fb064514ff3bd30d1e3a7398357\",\"6aa0d26a483148998c250b9c80ddf550\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Women in Black (1997)\",\"Bumblebee Movie (2007)\",\"<span class=\\\"formatted\\\" title=\\\"Magical School Boy and the Rock of Wise Men (2001)\\\">Magical School Boy and the Rock of Wi<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Master of the Jewlery: The Company of the Jewel (2001)\\\">Master of the Jewlery: The Company of<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Sun Conflicts: Part IV: A Novel Espair (1977)\\\">Sun Conflicts: Part IV: A Novel Espai<span class=\\\"structural\\\">...</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Fantasy|Suspenseful|Comedy\",\"Comedy|Jazz|Family|Animation\",\"Fantasy|Growing up|Magic\",\"Fantasy|Magic|Suspenseful\",\"Fantasy\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1977</span></span>\"] }, \n",
       "], id: -369098751, rootId: -369098751, totalRows: 5 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-369098751) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "moviesWithYear.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2f03354c",
   "metadata": {},
   "source": [
    "Looks fine!\n",
    "\n",
    "#### Now let's remove year from the title\n",
    "\n",
    "For this we will use the `update` function. Regex here looks complex, so here is the small explanation of it:\n",
    "\n",
    "```java\n",
    "\"\\\\s\" +        // Match a single character that is a “whitespace character”\n",
    "   \"*\" +         // Between zero and unlimited times, as many times as possible, giving back as needed\n",
    "\"\\\\\\(\" +        // Match the opening parenthesis character\n",
    "\"\\\\d\" +        // Match a single character that is a “digit”\n",
    "   \"{4}\" +       // Exactly 4 times\n",
    "\"\\\\\\)\" +        // Match the closing parenthesis character\n",
    "\"\\\\s\" +        // Match a single character that is a “whitespace character”\n",
    "   \"*\" +         // Between zero and unlimited times, as many times as possible, giving back as needed\n",
    "\"$\"           // Assert position at the end of the string, or before the line break at the end of the string, if any\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "e9d93026",
   "metadata": {},
   "outputs": [],
   "source": [
    "val movies = moviesWithYear\n",
    "                .update(\"title\"){\n",
    "                    \"\\\\s*\\\\(\\\\d{4}\\\\)\\\\s*$\".toRegex().replace(title, \"\")\n",
    "                }"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6caf6df7",
   "metadata": {},
   "source": [
    "####  Remove the movies with older than 1920\n",
    "\n",
    "Filtering is quite easy, we need to just call the `filter function`, like this:\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "b1c3ea1b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-369098750\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 20, columnsCount = 4</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"9b30aff7943f44579e92c261f3adc193\",\"2a1ba1fc5caf492a80188e032995843e\",\"f44ceb4771504342bb856d76c112d5a6\",\"43d02fb064514ff3bd30d1e3a7398357\",\"6aa0d26a483148998c250b9c80ddf550\",\"eace16e59ce24eff90bf8924eb6a926c\",\"ae916bc4844a4bb7b42b70d9573d05cd\",\"c1f0a868aeb44c5ea8d154ec3ca295ac\",\"9595b771f87f42a3b8dd07d91e7cb328\",\"aa9fc400e068443488b259ea0802a975\",\"22d20c2ba11d44cab83aceea39dc00bd\",\"8cf4d0c1bd7b41fab6af9d92c892141f\",\"c2f3e7588da84684a7d78d6bd8d8e1f4\",\"ce06175106af4105945f245161eac3c7\",\"ee28d7e69103485c83e10b8055ef15fb\",\"c32bdeed466f4ec09de828bb4b6fc649\",\"d4a325ab648a42c4a2d6f35dfabb387f\",\"60ebe74947234ddcab49dea1a958faed\",\"f24327f2b05147b197ca34bf13ae3524\",\"2bb29b3a245e434fa80542e711fd2cee\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Women in Black\",\"Bumblebee Movie\",\"<span class=\\\"formatted\\\" title=\\\"Magical School Boy and the Rock of Wise Men\\\">Magical School Boy and the Rock of Wi<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Master of the Jewlery: The Company of the Jewel\\\">Master of the Jewlery: The Company of<span class=\\\"structural\\\">...</span></span>\",\"Sun Conflicts: Part IV: A Novel Espair\",\"The Outstanding Bulk\",\"In Automata\",\"Interplanetary\",\"Woods Run\",\"Anthropod-Dude\",\"The Chamber\",\"That Thing About an Iceberg\",\"Vehicles\",\"Playthings Tale\",\"Metal Man 2\",\"Surgeon Odd in the Omniverse of Crazy\",\"Bad Dream on Pine Street\",\"The Shimmering\",\"<span class=\\\"formatted\\\" title=\\\"Krubit: Societal Teachings for Do Many Good Amazing Country of Uzbekistan\\\">Krubit: Societal Teachings for Do Man<span class=\\\"structural\\\">...</span></span>\",\"This is No Movie\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Fantasy|Suspenseful|Comedy\",\"Comedy|Jazz|Family|Animation\",\"Fantasy|Growing up|Magic\",\"Fantasy|Magic|Suspenseful\",\"Fantasy\",\"Fantasy|Superhero|Family\",\"Horror|Existential\",\"Sci-fi|Futuristic\",\"Family|Drama\",\"Superhero|Fantasy|Family|Growing up\",\"Comedy|Drama\",\"Drama|History|Family|Romance\",\"Animation|Family\",\"Animation|Family\",\"Fantasy|Superhero|Family\",\"Fantasy|Superhero|Family|Horror\",\"Horror\",\"Horror\",\"Comedy\",\"(no genres listed)\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1977</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1994</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2002</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2003</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2006</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1995</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2010</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2022</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1984</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1980</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2006</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1950</span></span>\"] }, \n",
       "], id: -369098750, rootId: -369098750, totalRows: 20 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-369098750) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "movies\n",
    "    .filter { year >= 1920 }"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b9396ccb",
   "metadata": {},
   "source": [
    "#### Remove lines where genre is `(no genres listed)`\n",
    "\n",
    "It's quite a simple operation again, just one more filter"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "b40766a9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-369098749\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 19, columnsCount = 4</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"9b30aff7943f44579e92c261f3adc193\",\"2a1ba1fc5caf492a80188e032995843e\",\"f44ceb4771504342bb856d76c112d5a6\",\"43d02fb064514ff3bd30d1e3a7398357\",\"6aa0d26a483148998c250b9c80ddf550\",\"eace16e59ce24eff90bf8924eb6a926c\",\"ae916bc4844a4bb7b42b70d9573d05cd\",\"c1f0a868aeb44c5ea8d154ec3ca295ac\",\"9595b771f87f42a3b8dd07d91e7cb328\",\"aa9fc400e068443488b259ea0802a975\",\"22d20c2ba11d44cab83aceea39dc00bd\",\"8cf4d0c1bd7b41fab6af9d92c892141f\",\"c2f3e7588da84684a7d78d6bd8d8e1f4\",\"ce06175106af4105945f245161eac3c7\",\"ee28d7e69103485c83e10b8055ef15fb\",\"c32bdeed466f4ec09de828bb4b6fc649\",\"d4a325ab648a42c4a2d6f35dfabb387f\",\"60ebe74947234ddcab49dea1a958faed\",\"f24327f2b05147b197ca34bf13ae3524\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Women in Black\",\"Bumblebee Movie\",\"<span class=\\\"formatted\\\" title=\\\"Magical School Boy and the Rock of Wise Men\\\">Magical School Boy and the Rock of Wi<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Master of the Jewlery: The Company of the Jewel\\\">Master of the Jewlery: The Company of<span class=\\\"structural\\\">...</span></span>\",\"Sun Conflicts: Part IV: A Novel Espair\",\"The Outstanding Bulk\",\"In Automata\",\"Interplanetary\",\"Woods Run\",\"Anthropod-Dude\",\"The Chamber\",\"That Thing About an Iceberg\",\"Vehicles\",\"Playthings Tale\",\"Metal Man 2\",\"Surgeon Odd in the Omniverse of Crazy\",\"Bad Dream on Pine Street\",\"The Shimmering\",\"<span class=\\\"formatted\\\" title=\\\"Krubit: Societal Teachings for Do Many Good Amazing Country of Uzbekistan\\\">Krubit: Societal Teachings for Do Man<span class=\\\"structural\\\">...</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Fantasy|Suspenseful|Comedy\",\"Comedy|Jazz|Family|Animation\",\"Fantasy|Growing up|Magic\",\"Fantasy|Magic|Suspenseful\",\"Fantasy\",\"Fantasy|Superhero|Family\",\"Horror|Existential\",\"Sci-fi|Futuristic\",\"Family|Drama\",\"Superhero|Fantasy|Family|Growing up\",\"Comedy|Drama\",\"Drama|History|Family|Romance\",\"Animation|Family\",\"Animation|Family\",\"Fantasy|Superhero|Family\",\"Fantasy|Superhero|Family|Horror\",\"Horror\",\"Horror\",\"Comedy\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1977</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1994</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2002</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2003</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2006</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1995</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2010</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2022</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1984</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1980</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2006</span></span>\"] }, \n",
       "], id: -369098749, rootId: -369098749, totalRows: 19 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-369098749) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "movies\n",
    "    .filter { year >= 1920 }\n",
    "    .filter { genres  != \"(no genres listed)\" }"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e4f82cc7",
   "metadata": {},
   "source": [
    "Or you can do everything in one filter"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "ea387005",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-369098748\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 19, columnsCount = 4</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"9b30aff7943f44579e92c261f3adc193\",\"2a1ba1fc5caf492a80188e032995843e\",\"f44ceb4771504342bb856d76c112d5a6\",\"43d02fb064514ff3bd30d1e3a7398357\",\"6aa0d26a483148998c250b9c80ddf550\",\"eace16e59ce24eff90bf8924eb6a926c\",\"ae916bc4844a4bb7b42b70d9573d05cd\",\"c1f0a868aeb44c5ea8d154ec3ca295ac\",\"9595b771f87f42a3b8dd07d91e7cb328\",\"aa9fc400e068443488b259ea0802a975\",\"22d20c2ba11d44cab83aceea39dc00bd\",\"8cf4d0c1bd7b41fab6af9d92c892141f\",\"c2f3e7588da84684a7d78d6bd8d8e1f4\",\"ce06175106af4105945f245161eac3c7\",\"ee28d7e69103485c83e10b8055ef15fb\",\"c32bdeed466f4ec09de828bb4b6fc649\",\"d4a325ab648a42c4a2d6f35dfabb387f\",\"60ebe74947234ddcab49dea1a958faed\",\"f24327f2b05147b197ca34bf13ae3524\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Women in Black\",\"Bumblebee Movie\",\"<span class=\\\"formatted\\\" title=\\\"Magical School Boy and the Rock of Wise Men\\\">Magical School Boy and the Rock of Wi<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Master of the Jewlery: The Company of the Jewel\\\">Master of the Jewlery: The Company of<span class=\\\"structural\\\">...</span></span>\",\"Sun Conflicts: Part IV: A Novel Espair\",\"The Outstanding Bulk\",\"In Automata\",\"Interplanetary\",\"Woods Run\",\"Anthropod-Dude\",\"The Chamber\",\"That Thing About an Iceberg\",\"Vehicles\",\"Playthings Tale\",\"Metal Man 2\",\"Surgeon Odd in the Omniverse of Crazy\",\"Bad Dream on Pine Street\",\"The Shimmering\",\"<span class=\\\"formatted\\\" title=\\\"Krubit: Societal Teachings for Do Many Good Amazing Country of Uzbekistan\\\">Krubit: Societal Teachings for Do Man<span class=\\\"structural\\\">...</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Fantasy|Suspenseful|Comedy\",\"Comedy|Jazz|Family|Animation\",\"Fantasy|Growing up|Magic\",\"Fantasy|Magic|Suspenseful\",\"Fantasy\",\"Fantasy|Superhero|Family\",\"Horror|Existential\",\"Sci-fi|Futuristic\",\"Family|Drama\",\"Superhero|Fantasy|Family|Growing up\",\"Comedy|Drama\",\"Drama|History|Family|Romance\",\"Animation|Family\",\"Animation|Family\",\"Fantasy|Superhero|Family\",\"Fantasy|Superhero|Family|Horror\",\"Horror\",\"Horror\",\"Comedy\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1977</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1994</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2002</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2003</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2006</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1995</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2010</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2022</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1984</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1980</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2006</span></span>\"] }, \n",
       "], id: -369098748, rootId: -369098748, totalRows: 19 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-369098748) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "movies\n",
    "    .filter { year >= 1920 && genres != \"(no genres listed)\" }"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "98b6251c",
   "metadata": {},
   "source": [
    "#### Split genres by `|` symbol\n",
    "\n",
    "Here we meet the next exciting concept of KotlinDF: built-in column operations. Most of them should be called right on dataframe! One of them is the `split` operation."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "a9010baa",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-369098747\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 19, columnsCount = 4</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"9b30aff7943f44579e92c261f3adc193\",\"2a1ba1fc5caf492a80188e032995843e\",\"f44ceb4771504342bb856d76c112d5a6\",\"43d02fb064514ff3bd30d1e3a7398357\",\"6aa0d26a483148998c250b9c80ddf550\",\"eace16e59ce24eff90bf8924eb6a926c\",\"ae916bc4844a4bb7b42b70d9573d05cd\",\"c1f0a868aeb44c5ea8d154ec3ca295ac\",\"9595b771f87f42a3b8dd07d91e7cb328\",\"aa9fc400e068443488b259ea0802a975\",\"22d20c2ba11d44cab83aceea39dc00bd\",\"8cf4d0c1bd7b41fab6af9d92c892141f\",\"c2f3e7588da84684a7d78d6bd8d8e1f4\",\"ce06175106af4105945f245161eac3c7\",\"ee28d7e69103485c83e10b8055ef15fb\",\"c32bdeed466f4ec09de828bb4b6fc649\",\"d4a325ab648a42c4a2d6f35dfabb387f\",\"60ebe74947234ddcab49dea1a958faed\",\"f24327f2b05147b197ca34bf13ae3524\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Women in Black\",\"Bumblebee Movie\",\"<span class=\\\"formatted\\\" title=\\\"Magical School Boy and the Rock of Wise Men\\\">Magical School Boy and the Rock of Wi<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Master of the Jewlery: The Company of the Jewel\\\">Master of the Jewlery: The Company of<span class=\\\"structural\\\">...</span></span>\",\"Sun Conflicts: Part IV: A Novel Espair\",\"The Outstanding Bulk\",\"In Automata\",\"Interplanetary\",\"Woods Run\",\"Anthropod-Dude\",\"The Chamber\",\"That Thing About an Iceberg\",\"Vehicles\",\"Playthings Tale\",\"Metal Man 2\",\"Surgeon Odd in the Omniverse of Crazy\",\"Bad Dream on Pine Street\",\"The Shimmering\",\"<span class=\\\"formatted\\\" title=\\\"Krubit: Societal Teachings for Do Many Good Amazing Country of Uzbekistan\\\">Krubit: Societal Teachings for Do Man<span class=\\\"structural\\\">...</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"genres: List<String>\\\">genres</span>\", children: [], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"Fantasy\\nSuspenseful\\nComedy\\\"><span class=\\\"structural\\\">[</span>Fantasy<span class=\\\"structural\\\">, </span>Suspenseful<span class=\\\"structural\\\">, </span>Comedy<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Comedy\\nJazz\\nFamily\\nAnimation\\\"><span class=\\\"structural\\\">[</span>Comedy<span class=\\\"structural\\\">, </span>Jazz<span class=\\\"structural\\\">, </span>Family<span class=\\\"structural\\\">, </span>Animation<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy\\nGrowing up\\nMagic\\\"><span class=\\\"structural\\\">[</span>Fantasy<span class=\\\"structural\\\">, </span>Growing up<span class=\\\"structural\\\">, </span>Magic<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy\\nMagic\\nSuspenseful\\\"><span class=\\\"structural\\\">[</span>Fantasy<span class=\\\"structural\\\">, </span>Magic<span class=\\\"structural\\\">, </span>Suspenseful<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy\\\"><span class=\\\"structural\\\">[</span>Fantasy<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy\\nSuperhero\\nFamily\\\"><span class=\\\"structural\\\">[</span>Fantasy<span class=\\\"structural\\\">, </span>Superhero<span class=\\\"structural\\\">, </span>Family<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Horror\\nExistential\\\"><span class=\\\"structural\\\">[</span>Horror<span class=\\\"structural\\\">, </span>Existential<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Sci-fi\\nFuturistic\\\"><span class=\\\"structural\\\">[</span>Sci-fi<span class=\\\"structural\\\">, </span>Futuristic<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Family\\nDrama\\\"><span class=\\\"structural\\\">[</span>Family<span class=\\\"structural\\\">, </span>Drama<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Superhero\\nFantasy\\nFamily\\nGrowing up\\\"><span class=\\\"structural\\\">[</span>Superhero<span class=\\\"structural\\\">, </span>Fantasy<span class=\\\"structural\\\">, </span>Family<span class=\\\"structural\\\">, </span>Growing up<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Comedy\\nDrama\\\"><span class=\\\"structural\\\">[</span>Comedy<span class=\\\"structural\\\">, </span>Drama<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Drama\\nHistory\\nFamily\\nRomance\\\"><span class=\\\"structural\\\">[</span>Drama<span class=\\\"structural\\\">, </span>History<span class=\\\"structural\\\">, </span>Family<span class=\\\"structural\\\">, </span>Romance<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Animation\\nFamily\\\"><span class=\\\"structural\\\">[</span>Animation<span class=\\\"structural\\\">, </span>Family<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Animation\\nFamily\\\"><span class=\\\"structural\\\">[</span>Animation<span class=\\\"structural\\\">, </span>Family<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy\\nSuperhero\\nFamily\\\"><span class=\\\"structural\\\">[</span>Fantasy<span class=\\\"structural\\\">, </span>Superhero<span class=\\\"structural\\\">, </span>Family<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy\\nSuperhero\\nFamily\\nHorror\\\"><span class=\\\"structural\\\">[</span>Fantasy<span class=\\\"structural\\\">, </span>Superhero<span class=\\\"structural\\\">, </span>Family<span class=\\\"structural\\\">, </span>Horror<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Horror\\\"><span class=\\\"structural\\\">[</span>Horror<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Horror\\\"><span class=\\\"structural\\\">[</span>Horror<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Comedy\\\"><span class=\\\"structural\\\">[</span>Comedy<span class=\\\"structural\\\">]</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1977</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1994</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2002</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2003</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2006</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1995</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2010</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2022</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1984</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1980</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2006</span></span>\"] }, \n",
       "], id: -369098747, rootId: -369098747, totalRows: 19 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-369098747) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "movies\n",
    "    .filter { year >= 1920 && genres  != \"(no genres listed)\" }\n",
    "    .split { genres }.by(\"|\").inplace()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "eee011ae",
   "metadata": {},
   "source": [
    "_NB: the whole `split` operation is type-safe. We cannot call other operations on DF until we will finish splitting._\n",
    "\n",
    "`inplace` here means that we want to replace current `genres` column with new content: String with array of strings."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5e565279",
   "metadata": {},
   "source": [
    "#### Convert each row with multiple genres with multiple rows single genre each\n",
    "\n",
    "There is a special `explode` function right for this task! And again, despite it being an operation on column we can pretend that we're performing it on DF."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "92cba457",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-369098746\"></table>\n",
       "\n",
       "<p>... showing only top 20 of 47 rows</p><p>DataFrame: rowsCount = 47, columnsCount = 4</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"9b30aff7943f44579e92c261f3adc193\",\"9b30aff7943f44579e92c261f3adc193\",\"9b30aff7943f44579e92c261f3adc193\",\"2a1ba1fc5caf492a80188e032995843e\",\"2a1ba1fc5caf492a80188e032995843e\",\"2a1ba1fc5caf492a80188e032995843e\",\"2a1ba1fc5caf492a80188e032995843e\",\"f44ceb4771504342bb856d76c112d5a6\",\"f44ceb4771504342bb856d76c112d5a6\",\"f44ceb4771504342bb856d76c112d5a6\",\"43d02fb064514ff3bd30d1e3a7398357\",\"43d02fb064514ff3bd30d1e3a7398357\",\"43d02fb064514ff3bd30d1e3a7398357\",\"6aa0d26a483148998c250b9c80ddf550\",\"eace16e59ce24eff90bf8924eb6a926c\",\"eace16e59ce24eff90bf8924eb6a926c\",\"eace16e59ce24eff90bf8924eb6a926c\",\"ae916bc4844a4bb7b42b70d9573d05cd\",\"ae916bc4844a4bb7b42b70d9573d05cd\",\"c1f0a868aeb44c5ea8d154ec3ca295ac\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Women in Black\",\"Women in Black\",\"Women in Black\",\"Bumblebee Movie\",\"Bumblebee Movie\",\"Bumblebee Movie\",\"Bumblebee Movie\",\"<span class=\\\"formatted\\\" title=\\\"Magical School Boy and the Rock of Wise Men\\\">Magical School Boy and the Rock of Wi<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Magical School Boy and the Rock of Wise Men\\\">Magical School Boy and the Rock of Wi<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Magical School Boy and the Rock of Wise Men\\\">Magical School Boy and the Rock of Wi<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Master of the Jewlery: The Company of the Jewel\\\">Master of the Jewlery: The Company of<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Master of the Jewlery: The Company of the Jewel\\\">Master of the Jewlery: The Company of<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Master of the Jewlery: The Company of the Jewel\\\">Master of the Jewlery: The Company of<span class=\\\"structural\\\">...</span></span>\",\"Sun Conflicts: Part IV: A Novel Espair\",\"The Outstanding Bulk\",\"The Outstanding Bulk\",\"The Outstanding Bulk\",\"In Automata\",\"In Automata\",\"Interplanetary\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Fantasy\",\"Suspenseful\",\"Comedy\",\"Comedy\",\"Jazz\",\"Family\",\"Animation\",\"Fantasy\",\"Growing up\",\"Magic\",\"Fantasy\",\"Magic\",\"Suspenseful\",\"Fantasy\",\"Fantasy\",\"Superhero\",\"Family\",\"Horror\",\"Existential\",\"Sci-fi\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1977</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\"] }, \n",
       "], id: -369098746, rootId: -369098746, totalRows: 47 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-369098746) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "movies\n",
    "    .filter { year >= 1920 && genres  != \"(no genres listed)\" }\n",
    "    .split { genres }.by(\"|\").inplace()\n",
    "    .explode { genres }"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fba59f32",
   "metadata": {},
   "source": [
    "To make it even easier, we can immediately split the column into lines."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "744c8f49",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-369098745\"></table>\n",
       "\n",
       "<p>... showing only top 20 of 47 rows</p><p>DataFrame: rowsCount = 47, columnsCount = 4</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"9b30aff7943f44579e92c261f3adc193\",\"9b30aff7943f44579e92c261f3adc193\",\"9b30aff7943f44579e92c261f3adc193\",\"2a1ba1fc5caf492a80188e032995843e\",\"2a1ba1fc5caf492a80188e032995843e\",\"2a1ba1fc5caf492a80188e032995843e\",\"2a1ba1fc5caf492a80188e032995843e\",\"f44ceb4771504342bb856d76c112d5a6\",\"f44ceb4771504342bb856d76c112d5a6\",\"f44ceb4771504342bb856d76c112d5a6\",\"43d02fb064514ff3bd30d1e3a7398357\",\"43d02fb064514ff3bd30d1e3a7398357\",\"43d02fb064514ff3bd30d1e3a7398357\",\"6aa0d26a483148998c250b9c80ddf550\",\"eace16e59ce24eff90bf8924eb6a926c\",\"eace16e59ce24eff90bf8924eb6a926c\",\"eace16e59ce24eff90bf8924eb6a926c\",\"ae916bc4844a4bb7b42b70d9573d05cd\",\"ae916bc4844a4bb7b42b70d9573d05cd\",\"c1f0a868aeb44c5ea8d154ec3ca295ac\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Women in Black\",\"Women in Black\",\"Women in Black\",\"Bumblebee Movie\",\"Bumblebee Movie\",\"Bumblebee Movie\",\"Bumblebee Movie\",\"<span class=\\\"formatted\\\" title=\\\"Magical School Boy and the Rock of Wise Men\\\">Magical School Boy and the Rock of Wi<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Magical School Boy and the Rock of Wise Men\\\">Magical School Boy and the Rock of Wi<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Magical School Boy and the Rock of Wise Men\\\">Magical School Boy and the Rock of Wi<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Master of the Jewlery: The Company of the Jewel\\\">Master of the Jewlery: The Company of<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Master of the Jewlery: The Company of the Jewel\\\">Master of the Jewlery: The Company of<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Master of the Jewlery: The Company of the Jewel\\\">Master of the Jewlery: The Company of<span class=\\\"structural\\\">...</span></span>\",\"Sun Conflicts: Part IV: A Novel Espair\",\"The Outstanding Bulk\",\"The Outstanding Bulk\",\"The Outstanding Bulk\",\"In Automata\",\"In Automata\",\"Interplanetary\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Fantasy\",\"Suspenseful\",\"Comedy\",\"Comedy\",\"Jazz\",\"Family\",\"Animation\",\"Fantasy\",\"Growing up\",\"Magic\",\"Fantasy\",\"Magic\",\"Suspenseful\",\"Fantasy\",\"Fantasy\",\"Superhero\",\"Family\",\"Horror\",\"Existential\",\"Sci-fi\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1977</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\"] }, \n",
       "], id: -369098745, rootId: -369098745, totalRows: 47 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-369098745) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "movies\n",
    "    .filter { year >= 1920 && genres  != \"(no genres listed)\" }\n",
    "    .split { genres }.by(\"|\").intoRows()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6cfb6144",
   "metadata": {},
   "source": [
    "Now, when the data is denormalised enough, analytics starts!\n",
    "\n",
    "#### Grouping\n",
    "\n",
    "First thing we should do here is to group the data by year and genre"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "0e7e5b3a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-369098744\"></table>\n",
       "\n",
       "<p>... showing only top 20 of 45 rows</p><p>GroupBy</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1977</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1994</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Fantasy\",\"Suspenseful\",\"Comedy\",\"Comedy\",\"Jazz\",\"Family\",\"Animation\",\"Fantasy\",\"Growing up\",\"Magic\",\"Suspenseful\",\"Fantasy\",\"Fantasy\",\"Superhero\",\"Family\",\"Horror\",\"Existential\",\"Sci-fi\",\"Futuristic\",\"Family\"] }, \n",
       "{ name: \"<span title=\\\"group: DataFrame\\\">group</span>\", children: [], rightAlign: false, values: [{ frameId: -369098743, value: \"<b>DataFrame 1 x 4</b>\" },{ frameId: -369098742, value: \"<b>DataFrame 1 x 4</b>\" },{ frameId: -369098741, value: \"<b>DataFrame 1 x 4</b>\" },{ frameId: -369098740, value: \"<b>DataFrame 1 x 4</b>\" },{ frameId: -369098739, value: \"<b>DataFrame 1 x 4</b>\" },{ frameId: -369098738, value: \"<b>DataFrame 1 x 4</b>\" },{ frameId: -369098737, value: \"<b>DataFrame 1 x 4</b>\" },{ frameId: -369098736, value: \"<b>DataFrame 2 x 4</b>\" },{ frameId: -369098735, value: \"<b>DataFrame 1 x 4</b>\" },{ frameId: -369098734, value: \"<b>DataFrame 2 x 4</b>\" },{ frameId: -369098733, value: \"<b>DataFrame 1 x 4</b>\" },{ frameId: -369098732, value: \"<b>DataFrame 1 x 4</b>\" },{ frameId: -369098731, value: \"<b>DataFrame 1 x 4</b>\" },{ frameId: -369098730, value: \"<b>DataFrame 1 x 4</b>\" },{ frameId: -369098729, value: \"<b>DataFrame 1 x 4</b>\" },{ frameId: -369098728, value: \"<b>DataFrame 1 x 4</b>\" },{ frameId: -369098727, value: \"<b>DataFrame 1 x 4</b>\" },{ frameId: -369098726, value: \"<b>DataFrame 1 x 4</b>\" },{ frameId: -369098725, value: \"<b>DataFrame 1 x 4</b>\" },{ frameId: -369098724, value: \"<b>DataFrame 1 x 4</b>\" }] }, \n",
       "], id: -369098744, rootId: -369098744, totalRows: 45 } ) });\n",
       "/*-->*/\n",
       "\n",
       "/*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"9b30aff7943f44579e92c261f3adc193\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Women in Black\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Fantasy\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\"] }, \n",
       "], id: -369098743, rootId: -369098744, totalRows: 1 } ) });\n",
       "/*-->*/\n",
       "\n",
       "/*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"9b30aff7943f44579e92c261f3adc193\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Women in Black\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Suspenseful\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\"] }, \n",
       "], id: -369098742, rootId: -369098744, totalRows: 1 } ) });\n",
       "/*-->*/\n",
       "\n",
       "/*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"9b30aff7943f44579e92c261f3adc193\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Women in Black\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Comedy\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\"] }, \n",
       "], id: -369098741, rootId: -369098744, totalRows: 1 } ) });\n",
       "/*-->*/\n",
       "\n",
       "/*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"2a1ba1fc5caf492a80188e032995843e\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Bumblebee Movie\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Comedy\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\"] }, \n",
       "], id: -369098740, rootId: -369098744, totalRows: 1 } ) });\n",
       "/*-->*/\n",
       "\n",
       "/*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"2a1ba1fc5caf492a80188e032995843e\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Bumblebee Movie\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Jazz\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\"] }, \n",
       "], id: -369098739, rootId: -369098744, totalRows: 1 } ) });\n",
       "/*-->*/\n",
       "\n",
       "/*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"2a1ba1fc5caf492a80188e032995843e\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Bumblebee Movie\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Family\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\"] }, \n",
       "], id: -369098738, rootId: -369098744, totalRows: 1 } ) });\n",
       "/*-->*/\n",
       "\n",
       "/*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"2a1ba1fc5caf492a80188e032995843e\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Bumblebee Movie\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Animation\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\"] }, \n",
       "], id: -369098737, rootId: -369098744, totalRows: 1 } ) });\n",
       "/*-->*/\n",
       "\n",
       "/*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"f44ceb4771504342bb856d76c112d5a6\",\"43d02fb064514ff3bd30d1e3a7398357\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"Magical School Boy and the Rock of Wise Men\\\">Magical School Boy and the Rock of Wi<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Master of the Jewlery: The Company of the Jewel\\\">Master of the Jewlery: The Company of<span class=\\\"structural\\\">...</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Fantasy\",\"Fantasy\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\"] }, \n",
       "], id: -369098736, rootId: -369098744, totalRows: 2 } ) });\n",
       "/*-->*/\n",
       "\n",
       "/*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"f44ceb4771504342bb856d76c112d5a6\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"Magical School Boy and the Rock of Wise Men\\\">Magical School Boy and the Rock of Wi<span class=\\\"structural\\\">...</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Growing up\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\"] }, \n",
       "], id: -369098735, rootId: -369098744, totalRows: 1 } ) });\n",
       "/*-->*/\n",
       "\n",
       "/*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"f44ceb4771504342bb856d76c112d5a6\",\"43d02fb064514ff3bd30d1e3a7398357\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"Magical School Boy and the Rock of Wise Men\\\">Magical School Boy and the Rock of Wi<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Master of the Jewlery: The Company of the Jewel\\\">Master of the Jewlery: The Company of<span class=\\\"structural\\\">...</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Magic\",\"Magic\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\"] }, \n",
       "], id: -369098734, rootId: -369098744, totalRows: 2 } ) });\n",
       "/*-->*/\n",
       "\n",
       "/*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"43d02fb064514ff3bd30d1e3a7398357\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"Master of the Jewlery: The Company of the Jewel\\\">Master of the Jewlery: The Company of<span class=\\\"structural\\\">...</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Suspenseful\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\"] }, \n",
       "], id: -369098733, rootId: -369098744, totalRows: 1 } ) });\n",
       "/*-->*/\n",
       "\n",
       "/*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"6aa0d26a483148998c250b9c80ddf550\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Sun Conflicts: Part IV: A Novel Espair\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Fantasy\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1977</span></span>\"] }, \n",
       "], id: -369098732, rootId: -369098744, totalRows: 1 } ) });\n",
       "/*-->*/\n",
       "\n",
       "/*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"eace16e59ce24eff90bf8924eb6a926c\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"The Outstanding Bulk\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Fantasy\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\"] }, \n",
       "], id: -369098731, rootId: -369098744, totalRows: 1 } ) });\n",
       "/*-->*/\n",
       "\n",
       "/*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"eace16e59ce24eff90bf8924eb6a926c\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"The Outstanding Bulk\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Superhero\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\"] }, \n",
       "], id: -369098730, rootId: -369098744, totalRows: 1 } ) });\n",
       "/*-->*/\n",
       "\n",
       "/*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"eace16e59ce24eff90bf8924eb6a926c\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"The Outstanding Bulk\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Family\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\"] }, \n",
       "], id: -369098729, rootId: -369098744, totalRows: 1 } ) });\n",
       "/*-->*/\n",
       "\n",
       "/*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"ae916bc4844a4bb7b42b70d9573d05cd\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"In Automata\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Horror\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\"] }, \n",
       "], id: -369098728, rootId: -369098744, totalRows: 1 } ) });\n",
       "/*-->*/\n",
       "\n",
       "/*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"ae916bc4844a4bb7b42b70d9573d05cd\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"In Automata\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Existential\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\"] }, \n",
       "], id: -369098727, rootId: -369098744, totalRows: 1 } ) });\n",
       "/*-->*/\n",
       "\n",
       "/*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"c1f0a868aeb44c5ea8d154ec3ca295ac\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Interplanetary\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Sci-fi\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\"] }, \n",
       "], id: -369098726, rootId: -369098744, totalRows: 1 } ) });\n",
       "/*-->*/\n",
       "\n",
       "/*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"c1f0a868aeb44c5ea8d154ec3ca295ac\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Interplanetary\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Futuristic\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\"] }, \n",
       "], id: -369098725, rootId: -369098744, totalRows: 1 } ) });\n",
       "/*-->*/\n",
       "\n",
       "/*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"9595b771f87f42a3b8dd07d91e7cb328\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Woods Run\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Family\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1994</span></span>\"] }, \n",
       "], id: -369098724, rootId: -369098744, totalRows: 1 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-369098744) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "movies\n",
    "    .filter { year >= 1920 && genres  != \"(no genres listed)\" }\n",
    "    .split { genres }.by(\"|\").intoRows()\n",
    "    .groupBy { year and genres }"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e155a45b",
   "metadata": {},
   "source": [
    "_Several interesting obsevations here_\n",
    "\n",
    "1. we have a synthetic column called `group` here, that contains dataframes inside. This means that DataFrames here are first-class citizens. DFs can contain other DFs up to infinite depth!\n",
    "1. Returned type from previous is of type `GroupBy`, that allows us to perform special *aggregation* operations\n",
    "\n",
    "#### Counting movies in groups"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "99826ece",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-369098718\"></table>\n",
       "\n",
       "<p>... showing only top 20 of 45 rows</p><p>DataFrame: rowsCount = 45, columnsCount = 3</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1977</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1994</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Fantasy\",\"Magic\",\"Fantasy\",\"Suspenseful\",\"Comedy\",\"Comedy\",\"Jazz\",\"Family\",\"Animation\",\"Growing up\",\"Suspenseful\",\"Fantasy\",\"Fantasy\",\"Superhero\",\"Family\",\"Horror\",\"Existential\",\"Sci-fi\",\"Futuristic\",\"Family\"] }, \n",
       "{ name: \"<span title=\\\"count: Int\\\">count</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\"] }, \n",
       "], id: -369098718, rootId: -369098718, totalRows: 45 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-369098718) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "movies\n",
    "    .filter { year >= 1920 && genres  != \"(no genres listed)\" }\n",
    "    .split { genres }.by(\"|\").intoRows()\n",
    "    .groupBy { year and genres }.count()\n",
    "    .sortBy { it[\"count\"].desc() }"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a1bd1f06",
   "metadata": {},
   "source": [
    "Let's visualize this data and we'll see\n",
    "\n",
    "![]()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "171dddcc",
   "metadata": {},
   "source": [
    "Alternative way to visualize the data is to build a pivot table. The principle is basically the same."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "21e73488",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-369098722\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 15, columnsCount = 2</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1977</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1980</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1984</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1994</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1995</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2002</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2003</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2006</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2010</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2022</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Fantasy: Int\\\">Fantasy</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Horror: Int\\\">Horror</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Drama: Int\\\">Drama</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Family: Int\\\">Family</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Animation: Int\\\">Animation</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Comedy: Int\\\">Comedy</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"History: Int\\\">History</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Romance: Int\\\">Romance</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Suspenseful: Int\\\">Suspenseful</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Growing up: Int\\\">Growing up</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Magic: Int\\\">Magic</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Superhero: Int\\\">Superhero</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Jazz: Int\\\">Jazz</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Existential: Int\\\">Existential</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Futuristic: Int\\\">Futuristic</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Sci-fi: Int\\\">Sci-fi</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"genres: DataRow\\\">genres</span>\", children: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 1\\nHorror: 0\\nDrama: 0\\nFamily: 0\\nAnimation: 0\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 0\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 0\\nHorror: 1\\nDrama: 0\\nFamily: 0\\nAnimation: 0\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 0\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 0\\nHorror: 1\\nDrama: 0\\nFamily: 0\\nAnimation: 0\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 0\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 0\\nHorror: 0\\nDrama: 1\\nFamily: 1\\nAnimation: 0\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 0\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 0\\nHorror: 0\\nDrama: 0\\nFamily: 1\\nAnimation: 1\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 0\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 1\\nHorror: 0\\nDrama: 1\\nFamily: 1\\nAnimation: 0\\nComedy: 1\\nHistory: 1\\nRomance: 1\\nSuspenseful: 1\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 0\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 2\\nHorror: 0\\nDrama: 0\\nFamily: 0\\nAnimation: 0\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 1\\nGrowing up: 1\\nMagic: 2\\nSuperhero: 0\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">2</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 1\\nHorror: 0\\nDrama: 0\\nFamily: 1\\nAnimation: 0\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 1\\nMagic: 0\\nSuperhero: 1\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 0\\nHorror: 0\\nDrama: 1\\nFamily: 0\\nAnimation: 0\\nComedy: 1\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 0\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 0\\nHorror: 0\\nDrama: 0\\nFamily: 1\\nAnimation: 1\\nComedy: 1\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 0\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 0\\nHorror: 0\\nDrama: 0\\nFamily: 1\\nAnimation: 1\\nComedy: 1\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 0\\nJazz: 1\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 1\\nHorror: 0\\nDrama: 0\\nFamily: 1\\nAnimation: 0\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 1\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 1\\nHorror: 0\\nDrama: 0\\nFamily: 1\\nAnimation: 0\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 1\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 0\\nHorror: 1\\nDrama: 0\\nFamily: 0\\nAnimation: 0\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 0\\nJazz: 0\\nExistential: 1\\nFuturistic: 1\\nSci-fi: 1\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 1\\nHorror: 1\\nDrama: 0\\nFamily: 1\\nAnimation: 0\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 1\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\"] }, \n",
       "], id: -369098722, rootId: -369098722, totalRows: 15 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-369098722) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "movies\n",
    "    .filter { year >= 1920 && genres  != \"(no genres listed)\" }\n",
    "    .split { genres }.by(\"|\").intoRows()\n",
    "    .sortBy { year and genres}\n",
    "    .groupBy { year }.pivot { genres }.count()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9f298812",
   "metadata": {},
   "source": [
    "`pivot { genres }.count()` can be replaced with shortcut operation `pivotCounts { genres }`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "50cbf68b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-369098721\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 15, columnsCount = 2</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1977</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1980</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1984</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1994</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1995</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2002</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2003</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2006</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2010</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2022</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Fantasy: Int\\\">Fantasy</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Horror: Int\\\">Horror</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Drama: Int\\\">Drama</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Family: Int\\\">Family</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Animation: Int\\\">Animation</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Comedy: Int\\\">Comedy</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"History: Int\\\">History</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Romance: Int\\\">Romance</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Suspenseful: Int\\\">Suspenseful</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Growing up: Int\\\">Growing up</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Magic: Int\\\">Magic</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Superhero: Int\\\">Superhero</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Jazz: Int\\\">Jazz</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Existential: Int\\\">Existential</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Futuristic: Int\\\">Futuristic</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"Sci-fi: Int\\\">Sci-fi</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"genres: DataRow\\\">genres</span>\", children: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 1\\nHorror: 0\\nDrama: 0\\nFamily: 0\\nAnimation: 0\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 0\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 0\\nHorror: 1\\nDrama: 0\\nFamily: 0\\nAnimation: 0\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 0\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 0\\nHorror: 1\\nDrama: 0\\nFamily: 0\\nAnimation: 0\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 0\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 0\\nHorror: 0\\nDrama: 1\\nFamily: 1\\nAnimation: 0\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 0\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 0\\nHorror: 0\\nDrama: 0\\nFamily: 1\\nAnimation: 1\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 0\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 1\\nHorror: 0\\nDrama: 1\\nFamily: 1\\nAnimation: 0\\nComedy: 1\\nHistory: 1\\nRomance: 1\\nSuspenseful: 1\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 0\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 2\\nHorror: 0\\nDrama: 0\\nFamily: 0\\nAnimation: 0\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 1\\nGrowing up: 1\\nMagic: 2\\nSuperhero: 0\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">2</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 1\\nHorror: 0\\nDrama: 0\\nFamily: 1\\nAnimation: 0\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 1\\nMagic: 0\\nSuperhero: 1\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 0\\nHorror: 0\\nDrama: 1\\nFamily: 0\\nAnimation: 0\\nComedy: 1\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 0\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 0\\nHorror: 0\\nDrama: 0\\nFamily: 1\\nAnimation: 1\\nComedy: 1\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 0\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 0\\nHorror: 0\\nDrama: 0\\nFamily: 1\\nAnimation: 1\\nComedy: 1\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 0\\nJazz: 1\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 1\\nHorror: 0\\nDrama: 0\\nFamily: 1\\nAnimation: 0\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 1\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 1\\nHorror: 0\\nDrama: 0\\nFamily: 1\\nAnimation: 0\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 1\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 0\\nHorror: 1\\nDrama: 0\\nFamily: 0\\nAnimation: 0\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 0\\nJazz: 0\\nExistential: 1\\nFuturistic: 1\\nSci-fi: 1\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Fantasy: 1\\nHorror: 1\\nDrama: 0\\nFamily: 1\\nAnimation: 0\\nComedy: 0\\nHistory: 0\\nRomance: 0\\nSuspenseful: 0\\nGrowing up: 0\\nMagic: 0\\nSuperhero: 1\\nJazz: 0\\nExistential: 0\\nFuturistic: 0\\nSci-fi: 0\\\"><span class=\\\"structural\\\">{ </span><span class=\\\"structural\\\">Fantasy: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Horror: </span><span class=\\\"numbers\\\">1</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">Drama: </span><span class=\\\"numbers\\\">0</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\"> }</span></span>\"] }, \n",
       "], id: -369098721, rootId: -369098721, totalRows: 15 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-369098721) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "movies\n",
    "    .filter { year >= 1920 && genres  != \"(no genres listed)\" }\n",
    "    .split { genres }.by(\"|\").intoRows()\n",
    "    .sortBy { year and genres}\n",
    "    .groupBy { year }.pivotCounts { genres }"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c612a76f",
   "metadata": {},
   "source": [
    "Drama is the most popular all these years! I was a bit shocked when discovered it.\n",
    "\n",
    "Now let's move to th next part.\n",
    "\n",
    "### Find the most tagged movie\n",
    "\n",
    "Now, when you're familiar with basics, we can skip several things, but here is what we'e going to do:\n",
    "\n",
    "1. Read tags\n",
    "1. Join movies with tags\n",
    "1. group by movie id\n",
    "1. aggregate all tags into set (to remove duplicates if any)\n",
    "1. get 10 top-tagged movies\n",
    "1. ???\n",
    "1. PROFIT\n",
    "\n",
    "First let's read tags data and explare it's schema."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "8c4bde5b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "userId: Int\n",
       "movieId: String\n",
       "tag: String\n",
       "timestamp: Int\n"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val tags = DataFrame.read(\"../../idea-examples/movies/src/main/resources/tags.csv\")\n",
    "tags.schema()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a8e7c9f3",
   "metadata": {},
   "source": [
    "Nothing too shocking here. Optional `tag`, `userId`, `movieId`, and `timestamp`. We're note interested in `userId` and `timestamp` this time. Indeed, we should join on `movieId`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "81769f72",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-369098717\"></table>\n",
       "\n",
       "<p>... showing only top 20 of 41 rows</p><p>DataFrame: rowsCount = 41, columnsCount = 7</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"9b30aff7943f44579e92c261f3adc193\",\"2a1ba1fc5caf492a80188e032995843e\",\"f44ceb4771504342bb856d76c112d5a6\",\"f44ceb4771504342bb856d76c112d5a6\",\"43d02fb064514ff3bd30d1e3a7398357\",\"6aa0d26a483148998c250b9c80ddf550\",\"6aa0d26a483148998c250b9c80ddf550\",\"6aa0d26a483148998c250b9c80ddf550\",\"6aa0d26a483148998c250b9c80ddf550\",\"eace16e59ce24eff90bf8924eb6a926c\",\"ae916bc4844a4bb7b42b70d9573d05cd\",\"ae916bc4844a4bb7b42b70d9573d05cd\",\"ae916bc4844a4bb7b42b70d9573d05cd\",\"ae916bc4844a4bb7b42b70d9573d05cd\",\"ae916bc4844a4bb7b42b70d9573d05cd\",\"ae916bc4844a4bb7b42b70d9573d05cd\",\"ae916bc4844a4bb7b42b70d9573d05cd\",\"c1f0a868aeb44c5ea8d154ec3ca295ac\",\"c1f0a868aeb44c5ea8d154ec3ca295ac\",\"c1f0a868aeb44c5ea8d154ec3ca295ac\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Women in Black\",\"Bumblebee Movie\",\"<span class=\\\"formatted\\\" title=\\\"Magical School Boy and the Rock of Wise Men\\\">Magical School Boy and the Rock of Wi<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Magical School Boy and the Rock of Wise Men\\\">Magical School Boy and the Rock of Wi<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Master of the Jewlery: The Company of the Jewel\\\">Master of the Jewlery: The Company of<span class=\\\"structural\\\">...</span></span>\",\"Sun Conflicts: Part IV: A Novel Espair\",\"Sun Conflicts: Part IV: A Novel Espair\",\"Sun Conflicts: Part IV: A Novel Espair\",\"Sun Conflicts: Part IV: A Novel Espair\",\"The Outstanding Bulk\",\"In Automata\",\"In Automata\",\"In Automata\",\"In Automata\",\"In Automata\",\"In Automata\",\"In Automata\",\"Interplanetary\",\"Interplanetary\",\"Interplanetary\"] }, \n",
       "{ name: \"<span title=\\\"genres: String\\\">genres</span>\", children: [], rightAlign: false, values: [\"Fantasy|Suspenseful|Comedy\",\"Comedy|Jazz|Family|Animation\",\"Fantasy|Growing up|Magic\",\"Fantasy|Growing up|Magic\",\"Fantasy|Magic|Suspenseful\",\"Fantasy\",\"Fantasy\",\"Fantasy\",\"Fantasy\",\"Fantasy|Superhero|Family\",\"Horror|Existential\",\"Horror|Existential\",\"Horror|Existential\",\"Horror|Existential\",\"Horror|Existential\",\"Horror|Existential\",\"Horror|Existential\",\"Sci-fi|Futuristic\",\"Sci-fi|Futuristic\",\"Sci-fi|Futuristic\"] }, \n",
       "{ name: \"<span title=\\\"year: Int\\\">year</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1997</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2007</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2001</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1977</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1977</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1977</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1977</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2008</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2014</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"userId: Int?\\\">userId</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">19</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">20</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">19</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">91</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">19</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">87</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">87</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">87</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">87</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">4</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">4</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">4</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">87</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">87</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">87</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">91</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">4</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">19</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">87</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"tag: String?\\\">tag</span>\", children: [], rightAlign: false, values: [\"Oscar (Best Supporting Actress)\",\"bah\",\"fantasy\",\"based on book\",\"adventure\",\"sci-fi\",\"sci-fi\",\"science fiction\",\"space\",\"bad science\",\"great dialogue\",\"artificial intelligence\",\"philosophical\",\"android(s)/cyborg(s)\",\"artificial intelligence\",\"philosophical issues\",\"thought-provoking\",\"tense\",\"post-apocalyptic\",\"sci-fi\"] }, \n",
       "{ name: \"<span title=\\\"timestamp: Int?\\\">timestamp</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1446909853</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1155082282</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1445286144</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1414248543</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1445286141</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1439472256</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1522676660</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1522676703</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1522676664</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1522676752</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1573943604</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1573942979</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1573943033</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1542309549</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1542309599</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1522676687</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1415131203</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1573943042</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1445286136</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1542308464</span></span>\"] }, \n",
       "], id: -369098717, rootId: -369098717, totalRows: 41 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-369098717) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val moviesWithTags = movies.leftJoin(tags){ movieId }\n",
    "moviesWithTags"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "19add254",
   "metadata": {},
   "source": [
    "Quite simple, right? Just usual SQL-like syntax, with auto-completion in lamda, returning JOIN predicate.\n",
    "\n",
    "Now let's group and aggregate it"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "12733c1c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-369098716\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 20, columnsCount = 3</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"9b30aff7943f44579e92c261f3adc193\",\"2a1ba1fc5caf492a80188e032995843e\",\"f44ceb4771504342bb856d76c112d5a6\",\"43d02fb064514ff3bd30d1e3a7398357\",\"6aa0d26a483148998c250b9c80ddf550\",\"eace16e59ce24eff90bf8924eb6a926c\",\"ae916bc4844a4bb7b42b70d9573d05cd\",\"c1f0a868aeb44c5ea8d154ec3ca295ac\",\"9595b771f87f42a3b8dd07d91e7cb328\",\"aa9fc400e068443488b259ea0802a975\",\"22d20c2ba11d44cab83aceea39dc00bd\",\"8cf4d0c1bd7b41fab6af9d92c892141f\",\"c2f3e7588da84684a7d78d6bd8d8e1f4\",\"ce06175106af4105945f245161eac3c7\",\"ee28d7e69103485c83e10b8055ef15fb\",\"c32bdeed466f4ec09de828bb4b6fc649\",\"d4a325ab648a42c4a2d6f35dfabb387f\",\"60ebe74947234ddcab49dea1a958faed\",\"f24327f2b05147b197ca34bf13ae3524\",\"2bb29b3a245e434fa80542e711fd2cee\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Women in Black\",\"Bumblebee Movie\",\"<span class=\\\"formatted\\\" title=\\\"Magical School Boy and the Rock of Wise Men\\\">Magical School Boy and the Rock of Wi<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Master of the Jewlery: The Company of the Jewel\\\">Master of the Jewlery: The Company of<span class=\\\"structural\\\">...</span></span>\",\"Sun Conflicts: Part IV: A Novel Espair\",\"The Outstanding Bulk\",\"In Automata\",\"Interplanetary\",\"Woods Run\",\"Anthropod-Dude\",\"The Chamber\",\"That Thing About an Iceberg\",\"Vehicles\",\"Playthings Tale\",\"Metal Man 2\",\"Surgeon Odd in the Omniverse of Crazy\",\"Bad Dream on Pine Street\",\"The Shimmering\",\"<span class=\\\"formatted\\\" title=\\\"Krubit: Societal Teachings for Do Many Good Amazing Country of Uzbekistan\\\">Krubit: Societal Teachings for Do Man<span class=\\\"structural\\\">...</span></span>\",\"This is No Movie\"] }, \n",
       "{ name: \"<span title=\\\"tags: Set\\\">tags</span>\", children: [], rightAlign: false, values: [\"[Oscar (Best Supporting Actress)]\",\"[bah]\",\"[fantasy, based on book]\",\"[adventure]\",\"[sci-fi, science fiction, space]\",\"[bad science]\",\"<span class=\\\"formatted\\\" title=\\\"[great dialogue, artificial intelligence, philosophical, android(s)/cyborg(s), philosophical issues, thought-provoking]\\\">[great dialogue, artificial intellige<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"[tense, post-apocalyptic, sci-fi, apocalypse, space travel, visually appealing]\\\">[tense, post-apocalyptic, sci-fi, apo<span class=\\\"structural\\\">...</span></span>\",\"[classic]\",\"[quirky]\",\"[so bad it&#39;s good]\",\"[cliche, romantic]\",\"[]\",\"[]\",\"[franchise, sci-fi, science fiction]\",\"[]\",\"[tense]\",\"[horror]\",\"<span class=\\\"formatted\\\" title=\\\"[dark comedy, so bad it&#39;s good, documentary]\\\">[dark comedy, so bad it&#39;s good, docum<span class=\\\"structural\\\">...</span></span>\",\"[musical, unpredictable]\"] }, \n",
       "], id: -369098716, rootId: -369098716, totalRows: 20 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-369098716) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "moviesWithTags\n",
    "    .groupBy{ movieId }\n",
    "    .aggregate { \n",
    "        title.first() into \"title\"\n",
    "        tag.dropNulls().toSet() into \"tags\"\n",
    "    }"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5492b30c",
   "metadata": {},
   "source": [
    "Nothing new in grouping, but here we find the new syntax of aggregation. \n",
    "\n",
    "First, we **know** that when we group by `movieId` every `movieId` will match exactly one title. It means that in every group we can select any `title`. `first` is on of ways to achieve this goal. Potentially the fastest one.\n",
    "\n",
    "Second, we gather all tags into one set. Notice how we work with `tag` column as it was just usual collection. Miraclous, isn't it? Of course, in reality it's not a collection, but it's an object of type `DataColumn` which allows exporting data into some collctions. And on this collections we already can make any transformations we want."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4af6896a",
   "metadata": {},
   "source": [
    "Some `groupBy` aggregations can be simplified with shortcut functions. We can include `title` in key columns for grouping, so that our aggregation will reduce to a collection of all unique non-null `tag` values per every group. For such simple aggregation we can replace general `aggregate` operation with `values`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "33006264",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-369098715\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 20, columnsCount = 3</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"9b30aff7943f44579e92c261f3adc193\",\"2a1ba1fc5caf492a80188e032995843e\",\"f44ceb4771504342bb856d76c112d5a6\",\"43d02fb064514ff3bd30d1e3a7398357\",\"6aa0d26a483148998c250b9c80ddf550\",\"eace16e59ce24eff90bf8924eb6a926c\",\"ae916bc4844a4bb7b42b70d9573d05cd\",\"c1f0a868aeb44c5ea8d154ec3ca295ac\",\"9595b771f87f42a3b8dd07d91e7cb328\",\"aa9fc400e068443488b259ea0802a975\",\"22d20c2ba11d44cab83aceea39dc00bd\",\"8cf4d0c1bd7b41fab6af9d92c892141f\",\"c2f3e7588da84684a7d78d6bd8d8e1f4\",\"ce06175106af4105945f245161eac3c7\",\"ee28d7e69103485c83e10b8055ef15fb\",\"c32bdeed466f4ec09de828bb4b6fc649\",\"d4a325ab648a42c4a2d6f35dfabb387f\",\"60ebe74947234ddcab49dea1a958faed\",\"f24327f2b05147b197ca34bf13ae3524\",\"2bb29b3a245e434fa80542e711fd2cee\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"Women in Black\",\"Bumblebee Movie\",\"<span class=\\\"formatted\\\" title=\\\"Magical School Boy and the Rock of Wise Men\\\">Magical School Boy and the Rock of Wi<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Master of the Jewlery: The Company of the Jewel\\\">Master of the Jewlery: The Company of<span class=\\\"structural\\\">...</span></span>\",\"Sun Conflicts: Part IV: A Novel Espair\",\"The Outstanding Bulk\",\"In Automata\",\"Interplanetary\",\"Woods Run\",\"Anthropod-Dude\",\"The Chamber\",\"That Thing About an Iceberg\",\"Vehicles\",\"Playthings Tale\",\"Metal Man 2\",\"Surgeon Odd in the Omniverse of Crazy\",\"Bad Dream on Pine Street\",\"The Shimmering\",\"<span class=\\\"formatted\\\" title=\\\"Krubit: Societal Teachings for Do Many Good Amazing Country of Uzbekistan\\\">Krubit: Societal Teachings for Do Man<span class=\\\"structural\\\">...</span></span>\",\"This is No Movie\"] }, \n",
       "{ name: \"<span title=\\\"tags: List<String>\\\">tags</span>\", children: [], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"Oscar (Best Supporting Actress)\\\"><span class=\\\"structural\\\">[</span>Oscar (Best Supporting Actress)<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"bah\\\"><span class=\\\"structural\\\">[</span>bah<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"fantasy\\nbased on book\\\"><span class=\\\"structural\\\">[</span>fantasy<span class=\\\"structural\\\">, </span>based on book<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"adventure\\\"><span class=\\\"structural\\\">[</span>adventure<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"sci-fi\\nscience fiction\\nspace\\\"><span class=\\\"structural\\\">[</span>sci-fi<span class=\\\"structural\\\">, </span>science fiction<span class=\\\"structural\\\">, </span>space<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"bad science\\\"><span class=\\\"structural\\\">[</span>bad science<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"great dialogue\\nartificial intelligence\\nphilosophical\\nandroid(s)/cyborg(s)\\nphilosophical issues\\nthought-provoking\\\"><span class=\\\"structural\\\">[</span>great dialogue<span class=\\\"structural\\\">, </span>artificial int<span class=\\\"structural\\\">...</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"tense\\npost-apocalyptic\\nsci-fi\\napocalypse\\nspace travel\\nvisually appealing\\\"><span class=\\\"structural\\\">[</span>tense<span class=\\\"structural\\\">, </span>post-apocalyptic<span class=\\\"structural\\\">, </span>sci-fi<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"classic\\\"><span class=\\\"structural\\\">[</span>classic<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"quirky\\\"><span class=\\\"structural\\\">[</span>quirky<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"so bad it&#39;s good\\\"><span class=\\\"structural\\\">[</span>so bad it&#39;s good<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"cliche\\nromantic\\\"><span class=\\\"structural\\\">[</span>cliche<span class=\\\"structural\\\">, </span>romantic<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">[ ]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">[ ]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"franchise\\nsci-fi\\nscience fiction\\\"><span class=\\\"structural\\\">[</span>franchise<span class=\\\"structural\\\">, </span>sci-fi<span class=\\\"structural\\\">, </span>science fiction<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">[ ]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"tense\\\"><span class=\\\"structural\\\">[</span>tense<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"horror\\\"><span class=\\\"structural\\\">[</span>horror<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"dark comedy\\nso bad it&#39;s good\\ndocumentary\\\"><span class=\\\"structural\\\">[</span>dark comedy<span class=\\\"structural\\\">, </span>so bad it&#39;s good<span class=\\\"structural\\\">, </span>docu<span class=\\\"structural\\\">...</span><span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"musical\\nunpredictable\\\"><span class=\\\"structural\\\">[</span>musical<span class=\\\"structural\\\">, </span>unpredictable<span class=\\\"structural\\\">]</span></span>\"] }, \n",
       "], id: -369098715, rootId: -369098715, totalRows: 20 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-369098715) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "moviesWithTags\n",
    "    .groupBy{ movieId and title }.values(dropNA = true, distinct = true) { tag into \"tags\" }"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "17c342b7",
   "metadata": {},
   "source": [
    "Now we should find most tagged movies. For that we should sort by number of tags in descending order."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "83b17906",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-369098714\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 10, columnsCount = 3</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"ae916bc4844a4bb7b42b70d9573d05cd\",\"c1f0a868aeb44c5ea8d154ec3ca295ac\",\"6aa0d26a483148998c250b9c80ddf550\",\"ee28d7e69103485c83e10b8055ef15fb\",\"f24327f2b05147b197ca34bf13ae3524\",\"f44ceb4771504342bb856d76c112d5a6\",\"8cf4d0c1bd7b41fab6af9d92c892141f\",\"2bb29b3a245e434fa80542e711fd2cee\",\"9b30aff7943f44579e92c261f3adc193\",\"2a1ba1fc5caf492a80188e032995843e\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"In Automata\",\"Interplanetary\",\"Sun Conflicts: Part IV: A Novel Espair\",\"Metal Man 2\",\"<span class=\\\"formatted\\\" title=\\\"Krubit: Societal Teachings for Do Many Good Amazing Country of Uzbekistan\\\">Krubit: Societal Teachings for Do Man<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Magical School Boy and the Rock of Wise Men\\\">Magical School Boy and the Rock of Wi<span class=\\\"structural\\\">...</span></span>\",\"That Thing About an Iceberg\",\"This is No Movie\",\"Women in Black\",\"Bumblebee Movie\"] }, \n",
       "{ name: \"<span title=\\\"tags: List<String>\\\">tags</span>\", children: [], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"great dialogue\\nartificial intelligence\\nphilosophical\\nandroid(s)/cyborg(s)\\nphilosophical issues\\nthought-provoking\\\"><span class=\\\"structural\\\">[</span>great dialogue<span class=\\\"structural\\\">, </span>artificial int<span class=\\\"structural\\\">...</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"tense\\npost-apocalyptic\\nsci-fi\\napocalypse\\nspace travel\\nvisually appealing\\\"><span class=\\\"structural\\\">[</span>tense<span class=\\\"structural\\\">, </span>post-apocalyptic<span class=\\\"structural\\\">, </span>sci-fi<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"sci-fi\\nscience fiction\\nspace\\\"><span class=\\\"structural\\\">[</span>sci-fi<span class=\\\"structural\\\">, </span>science fiction<span class=\\\"structural\\\">, </span>space<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"franchise\\nsci-fi\\nscience fiction\\\"><span class=\\\"structural\\\">[</span>franchise<span class=\\\"structural\\\">, </span>sci-fi<span class=\\\"structural\\\">, </span>science fiction<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"dark comedy\\nso bad it&#39;s good\\ndocumentary\\\"><span class=\\\"structural\\\">[</span>dark comedy<span class=\\\"structural\\\">, </span>so bad it&#39;s good<span class=\\\"structural\\\">, </span>docu<span class=\\\"structural\\\">...</span><span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"fantasy\\nbased on book\\\"><span class=\\\"structural\\\">[</span>fantasy<span class=\\\"structural\\\">, </span>based on book<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"cliche\\nromantic\\\"><span class=\\\"structural\\\">[</span>cliche<span class=\\\"structural\\\">, </span>romantic<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"musical\\nunpredictable\\\"><span class=\\\"structural\\\">[</span>musical<span class=\\\"structural\\\">, </span>unpredictable<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Oscar (Best Supporting Actress)\\\"><span class=\\\"structural\\\">[</span>Oscar (Best Supporting Actress)<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"bah\\\"><span class=\\\"structural\\\">[</span>bah<span class=\\\"structural\\\">]</span></span>\"] }, \n",
       "], id: -369098714, rootId: -369098714, totalRows: 10 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-369098714) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "moviesWithTags\n",
    "    .groupBy{ movieId and title }.values(dropNA = true, distinct = true) { tag into \"tags\" }\n",
    "    .sortByDesc { expr { \"tags\"<List<*>>().count() } }\n",
    "    .take(10)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2bae07b4",
   "metadata": {},
   "source": [
    "OK, indeed there are lots of tags :) Let's output the number of tags into separate column"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "27c8ea28",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <html>\n",
       "        <head>\n",
       "            <style type=\"text/css\">\n",
       "                \n",
       "\n",
       "            </style>\n",
       "        </head>\n",
       "        <body>\n",
       "            <table class=\"dataframe\" id=\"df_-369098713\"></table>\n",
       "\n",
       "<p>DataFrame: rowsCount = 20, columnsCount = 4</p>\n",
       "        </body>\n",
       "        <script>\n",
       "            /*<!--*/\n",
       "call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: \"<span title=\\\"movieId: String\\\">movieId</span>\", children: [], rightAlign: false, values: [\"ae916bc4844a4bb7b42b70d9573d05cd\",\"c1f0a868aeb44c5ea8d154ec3ca295ac\",\"6aa0d26a483148998c250b9c80ddf550\",\"ee28d7e69103485c83e10b8055ef15fb\",\"f24327f2b05147b197ca34bf13ae3524\",\"f44ceb4771504342bb856d76c112d5a6\",\"8cf4d0c1bd7b41fab6af9d92c892141f\",\"2bb29b3a245e434fa80542e711fd2cee\",\"9b30aff7943f44579e92c261f3adc193\",\"2a1ba1fc5caf492a80188e032995843e\",\"43d02fb064514ff3bd30d1e3a7398357\",\"eace16e59ce24eff90bf8924eb6a926c\",\"9595b771f87f42a3b8dd07d91e7cb328\",\"aa9fc400e068443488b259ea0802a975\",\"22d20c2ba11d44cab83aceea39dc00bd\",\"d4a325ab648a42c4a2d6f35dfabb387f\",\"60ebe74947234ddcab49dea1a958faed\",\"c2f3e7588da84684a7d78d6bd8d8e1f4\",\"ce06175106af4105945f245161eac3c7\",\"c32bdeed466f4ec09de828bb4b6fc649\"] }, \n",
       "{ name: \"<span title=\\\"title: String\\\">title</span>\", children: [], rightAlign: false, values: [\"In Automata\",\"Interplanetary\",\"Sun Conflicts: Part IV: A Novel Espair\",\"Metal Man 2\",\"<span class=\\\"formatted\\\" title=\\\"Krubit: Societal Teachings for Do Many Good Amazing Country of Uzbekistan\\\">Krubit: Societal Teachings for Do Man<span class=\\\"structural\\\">...</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Magical School Boy and the Rock of Wise Men\\\">Magical School Boy and the Rock of Wi<span class=\\\"structural\\\">...</span></span>\",\"That Thing About an Iceberg\",\"This is No Movie\",\"Women in Black\",\"Bumblebee Movie\",\"<span class=\\\"formatted\\\" title=\\\"Master of the Jewlery: The Company of the Jewel\\\">Master of the Jewlery: The Company of<span class=\\\"structural\\\">...</span></span>\",\"The Outstanding Bulk\",\"Woods Run\",\"Anthropod-Dude\",\"The Chamber\",\"Bad Dream on Pine Street\",\"The Shimmering\",\"Vehicles\",\"Playthings Tale\",\"Surgeon Odd in the Omniverse of Crazy\"] }, \n",
       "{ name: \"<span title=\\\"tags: List<String>\\\">tags</span>\", children: [], rightAlign: false, values: [\"<span class=\\\"formatted\\\" title=\\\"great dialogue\\nartificial intelligence\\nphilosophical\\nandroid(s)/cyborg(s)\\nphilosophical issues\\nthought-provoking\\\"><span class=\\\"structural\\\">[</span>great dialogue<span class=\\\"structural\\\">, </span>artificial int<span class=\\\"structural\\\">...</span><span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"tense\\npost-apocalyptic\\nsci-fi\\napocalypse\\nspace travel\\nvisually appealing\\\"><span class=\\\"structural\\\">[</span>tense<span class=\\\"structural\\\">, </span>post-apocalyptic<span class=\\\"structural\\\">, </span>sci-fi<span class=\\\"structural\\\">, </span><span class=\\\"structural\\\">...</span><span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"sci-fi\\nscience fiction\\nspace\\\"><span class=\\\"structural\\\">[</span>sci-fi<span class=\\\"structural\\\">, </span>science fiction<span class=\\\"structural\\\">, </span>space<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"franchise\\nsci-fi\\nscience fiction\\\"><span class=\\\"structural\\\">[</span>franchise<span class=\\\"structural\\\">, </span>sci-fi<span class=\\\"structural\\\">, </span>science fiction<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"dark comedy\\nso bad it&#39;s good\\ndocumentary\\\"><span class=\\\"structural\\\">[</span>dark comedy<span class=\\\"structural\\\">, </span>so bad it&#39;s good<span class=\\\"structural\\\">, </span>docu<span class=\\\"structural\\\">...</span><span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"fantasy\\nbased on book\\\"><span class=\\\"structural\\\">[</span>fantasy<span class=\\\"structural\\\">, </span>based on book<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"cliche\\nromantic\\\"><span class=\\\"structural\\\">[</span>cliche<span class=\\\"structural\\\">, </span>romantic<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"musical\\nunpredictable\\\"><span class=\\\"structural\\\">[</span>musical<span class=\\\"structural\\\">, </span>unpredictable<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"Oscar (Best Supporting Actress)\\\"><span class=\\\"structural\\\">[</span>Oscar (Best Supporting Actress)<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"bah\\\"><span class=\\\"structural\\\">[</span>bah<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"adventure\\\"><span class=\\\"structural\\\">[</span>adventure<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"bad science\\\"><span class=\\\"structural\\\">[</span>bad science<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"classic\\\"><span class=\\\"structural\\\">[</span>classic<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"quirky\\\"><span class=\\\"structural\\\">[</span>quirky<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"so bad it&#39;s good\\\"><span class=\\\"structural\\\">[</span>so bad it&#39;s good<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"tense\\\"><span class=\\\"structural\\\">[</span>tense<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"horror\\\"><span class=\\\"structural\\\">[</span>horror<span class=\\\"structural\\\">]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">[ ]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">[ ]</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"null\\\">[ ]</span></span>\"] }, \n",
       "{ name: \"<span title=\\\"tagsCount: Int\\\">tagsCount</span>\", children: [], rightAlign: true, values: [\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">6</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">6</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">3</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">2</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">1</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\",\"<span class=\\\"formatted\\\" title=\\\"\\\"><span class=\\\"numbers\\\">0</span></span>\"] }, \n",
       "], id: -369098713, rootId: -369098713, totalRows: 20 } ) });\n",
       "/*-->*/\n",
       "\n",
       "call_DataFrame(function() { DataFrame.renderTable(-369098713) });\n",
       "\n",
       "\n",
       "        </script>\n",
       "        </html>"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "val tagsPerMovie = moviesWithTags\n",
    "    .groupBy{ movieId and title }.values(dropNA = true, distinct = true) { tag into \"tags\" }\n",
    "    .add(\"tagsCount\") {\n",
    "        \"tags\"<List<*>>().count()\n",
    "    }\n",
    "    .sortByDesc(\"tagsCount\")\n",
    "tagsPerMovie"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "01cbbed1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "36"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tagsPerMovie.tagsCount.sum()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2cd62dca",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "accea0d3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[great dialogue, artificial intelligence, philosophical, android(s)/cyborg(s), philosophical issues, thought-provoking]"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tagsPerMovie[0].tags"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c309c91b",
   "metadata": {},
   "source": [
    "And yes, I should admit, some of these tags are crazy.\n",
    "\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Kotlin",
   "language": "kotlin",
   "name": "kotlin"
  },
  "language_info": {
   "codemirror_mode": "text/x-kotlin",
   "file_extension": ".kt",
   "mimetype": "text/x-kotlin",
   "name": "kotlin",
   "nbconvert_exporter": "",
   "pygments_lexer": "kotlin",
   "version": "1.8.0-dev-707"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
